package logic

import (
	"stock_app/dao/etcd"
	"stock_app/dao/mongo"
	"stock_app/models"
)

func SaveJob(job *models.Job) (oldJob *models.Job, err error) {
	return etcd.SaveJob(job)
}

func DeleteJob(name string) (oldJob *models.Job, err error) {
	return etcd.DeleteJob(name)
}

func KillJob(name string) (err error) {
	return etcd.KillJob(name)
}

func GetJobList() ([]*models.Job, error) {
	//查询etcd中所有job 并返回
	return etcd.GetJobList()
}

func ListLog(name string, skip int64, limit int64) (logArr []*models.JobLog, err error) {
	return mongo.ListLog(name, skip, limit)
}

func GetWorkList() (workerArr []string, err error) {
	return etcd.GetWorkList()
}
